home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gcc_260.zip / gcc_260 / gcc.info-20 (.txt) < prev    next >
GNU Info File  |  1994-07-14  |  51KB  |  860 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Scalar Return,  Next: Aggregate Return,  Prev: Register Arguments,  Up: Stack and Calling
  23. How Scalar Function Values Are Returned
  24. ---------------------------------------
  25.    This section discusses the macros that control returning scalars as
  26. values--values that can fit in registers.
  27. `TRADITIONAL_RETURN_FLOAT'
  28.      Define this macro if `-traditional' should not cause functions
  29.      declared to return `float' to convert the value to `double'.
  30. `FUNCTION_VALUE (VALTYPE, FUNC)'
  31.      A C expression to create an RTX representing the place where a
  32.      function returns a value of data type VALTYPE.  VALTYPE is a tree
  33.      node representing a data type.  Write `TYPE_MODE (VALTYPE)' to get
  34.      the machine mode used to represent that type.  On many machines,
  35.      only the mode is relevant.  (Actually, on most machines, scalar
  36.      values are returned in the same place regardless of mode).
  37.      If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same
  38.      promotion rules specified in `PROMOTE_MODE' if VALTYPE is a scalar
  39.      type.
  40.      If the precise function being called is known, FUNC is a tree node
  41.      (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer.  This
  42.      makes it possible to use a different value-returning convention
  43.      for specific functions when all their calls are known.
  44.      `FUNCTION_VALUE' is not used for return vales with aggregate data
  45.      types, because these are returned in another way.  See
  46.      `STRUCT_VALUE_REGNUM' and related macros, below.
  47. `FUNCTION_OUTGOING_VALUE (VALTYPE, FUNC)'
  48.      Define this macro if the target machine has "register windows" so
  49.      that the register in which a function returns its value is not the
  50.      same as the one in which the caller sees the value.
  51.      For such machines, `FUNCTION_VALUE' computes the register in which
  52.      the caller will see the value.  `FUNCTION_OUTGOING_VALUE' should be
  53.      defined in a similar fashion to tell the function where to put the
  54.      value.
  55.      If `FUNCTION_OUTGOING_VALUE' is not defined, `FUNCTION_VALUE'
  56.      serves both purposes.
  57.      `FUNCTION_OUTGOING_VALUE' is not used for return vales with
  58.      aggregate data types, because these are returned in another way.
  59.      See `STRUCT_VALUE_REGNUM' and related macros, below.
  60. `LIBCALL_VALUE (MODE)'
  61.      A C expression to create an RTX representing the place where a
  62.      library function returns a value of mode MODE.  If the precise
  63.      function being called is known, FUNC is a tree node
  64.      (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer.  This
  65.      makes it possible to use a different value-returning convention
  66.      for specific functions when all their calls are known.
  67.      Note that "library function" in this context means a compiler
  68.      support routine, used to perform arithmetic, whose name is known
  69.      specially by the compiler and was not mentioned in the C code being
  70.      compiled.
  71.      The definition of `LIBRARY_VALUE' need not be concerned aggregate
  72.      data types, because none of the library functions returns such
  73.      types.
  74. `FUNCTION_VALUE_REGNO_P (REGNO)'
  75.      A C expression that is nonzero if REGNO is the number of a hard
  76.      register in which the values of called function may come back.
  77.      A register whose use for returning values is limited to serving as
  78.      the second of a pair (for a value of type `double', say) need not
  79.      be recognized by this macro.  So for most machines, this definition
  80.      suffices:
  81.           #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
  82.      If the machine has register windows, so that the caller and the
  83.      called function use different registers for the return value, this
  84.      macro should recognize only the caller's register numbers.
  85. `APPLY_RESULT_SIZE'
  86.      Define this macro if `untyped_call' and `untyped_return' need more
  87.      space than is implied by `FUNCTION_VALUE_REGNO_P' for saving and
  88.      restoring an arbitrary return value.
  89. File: gcc.info,  Node: Aggregate Return,  Next: Caller Saves,  Prev: Scalar Return,  Up: Stack and Calling
  90. How Large Values Are Returned
  91. -----------------------------
  92.    When a function value's mode is `BLKmode' (and in some other cases),
  93. the value is not returned according to `FUNCTION_VALUE' (*note Scalar
  94. Return::.).  Instead, the caller passes the address of a block of
  95. memory in which the value should be stored.  This address is called the
  96. "structure value address".
  97.    This section describes how to control returning structure values in
  98. memory.
  99. `RETURN_IN_MEMORY (TYPE)'
  100.      A C expression which can inhibit the returning of certain function
  101.      values in registers, based on the type of value.  A nonzero value
  102.      says to return the function value in memory, just as large
  103.      structures are always returned.  Here TYPE will be a C expression
  104.      of type `tree', representing the data type of the value.
  105.      Note that values of mode `BLKmode' must be explicitly handled by
  106.      this macro.  Also, the option `-fpcc-struct-return' takes effect
  107.      regardless of this macro.  On most systems, it is possible to
  108.      leave the macro undefined; this causes a default definition to be
  109.      used, whose value is the constant 1 for `BLKmode' values, and 0
  110.      otherwise.
  111.      Do not use this macro to indicate that structures and unions
  112.      should always be returned in memory.  You should instead use
  113.      `DEFAULT_PCC_STRUCT_RETURN' to indicate this.
  114. `DEFAULT_PCC_STRUCT_RETURN'
  115.      Define this macro to be 1 if all structure and union return values
  116.      must be in memory.  Since this results in slower code, this should
  117.      be defined only if needed for compatibility with other compilers
  118.      or with an ABI.  If you define this macro to be 0, then the
  119.      conventions used for structure and union return values are decided
  120.      by the `RETURN_IN_MEMORY' macro.
  121.      If not defined, this defaults to the value 1.
  122. `STRUCT_VALUE_REGNUM'
  123.      If the structure value address is passed in a register, then
  124.      `STRUCT_VALUE_REGNUM' should be the number of that register.
  125. `STRUCT_VALUE'
  126.      If the structure value address is not passed in a register, define
  127.      `STRUCT_VALUE' as an expression returning an RTX for the place
  128.      where the address is passed.  If it returns 0, the address is
  129.      passed as an "invisible" first argument.
  130. `STRUCT_VALUE_INCOMING_REGNUM'
  131.      On some architectures the place where the structure value address
  132.      is found by the called function is not the same place that the
  133.      caller put it.  This can be due to register windows, or it could
  134.      be because the function prologue moves it to a different place.
  135.      If the incoming location of the structure value address is in a
  136.      register, define this macro as the register number.
  137. `STRUCT_VALUE_INCOMING'
  138.      If the incoming location is not a register, then you should define
  139.      `STRUCT_VALUE_INCOMING' as an expression for an RTX for where the
  140.      called function should find the value.  If it should find the
  141.      value on the stack, define this to create a `mem' which refers to
  142.      the frame pointer.  A definition of 0 means that the address is
  143.      passed as an "invisible" first argument.
  144. `PCC_STATIC_STRUCT_RETURN'
  145.      Define this macro if the usual system convention on the target
  146.      machine for returning structures and unions is for the called
  147.      function to return the address of a static variable containing the
  148.      value.
  149.      Do not define this if the usual system convention is for the
  150.      caller to pass an address to the subroutine.
  151.      This macro has effect in `-fpcc-struct-return' mode, but it does
  152.      nothing when you use `-freg-struct-return' mode.
  153. File: gcc.info,  Node: Caller Saves,  Next: Function Entry,  Prev: Aggregate Return,  Up: Stack and Calling
  154. Caller-Saves Register Allocation
  155. --------------------------------
  156.    If you enable it, GNU CC can save registers around function calls.
  157. This makes it possible to use call-clobbered registers to hold
  158. variables that must live across calls.
  159. `DEFAULT_CALLER_SAVES'
  160.      Define this macro if function calls on the target machine do not
  161.      preserve any registers; in other words, if `CALL_USED_REGISTERS'
  162.      has 1 for all registers.  This macro enables `-fcaller-saves' by
  163.      default.  Eventually that option will be enabled by default on all
  164.      machines and both the option and this macro will be eliminated.
  165. `CALLER_SAVE_PROFITABLE (REFS, CALLS)'
  166.      A C expression to determine whether it is worthwhile to consider
  167.      placing a pseudo-register in a call-clobbered hard register and
  168.      saving and restoring it around each function call.  The expression
  169.      should be 1 when this is worth doing, and 0 otherwise.
  170.      If you don't define this macro, a default is used which is good on
  171.      most machines: `4 * CALLS < REFS'.
  172. File: gcc.info,  Node: Function Entry,  Next: Profiling,  Prev: Caller Saves,  Up: Stack and Calling
  173. Function Entry and Exit
  174. -----------------------
  175.    This section describes the macros that output function entry
  176. ("prologue") and exit ("epilogue") code.
  177. `FUNCTION_PROLOGUE (FILE, SIZE)'
  178.      A C compound statement that outputs the assembler code for entry
  179.      to a function.  The prologue is responsible for setting up the
  180.      stack frame, initializing the frame pointer register, saving
  181.      registers that must be saved, and allocating SIZE additional bytes
  182.      of storage for the local variables.  SIZE is an integer.  FILE is
  183.      a stdio stream to which the assembler code should be output.
  184.      The label for the beginning of the function need not be output by
  185.      this macro.  That has already been done when the macro is run.
  186.      To determine which registers to save, the macro can refer to the
  187.      array `regs_ever_live': element R is nonzero if hard register R is
  188.      used anywhere within the function.  This implies the function
  189.      prologue should save register R, provided it is not one of the
  190.      call-used registers.  (`FUNCTION_EPILOGUE' must likewise use
  191.      `regs_ever_live'.)
  192.      On machines that have "register windows", the function entry code
  193.      does not save on the stack the registers that are in the windows,
  194.      even if they are supposed to be preserved by function calls;
  195.      instead it takes appropriate steps to "push" the register stack,
  196.      if any non-call-used registers are used in the function.
  197.      On machines where functions may or may not have frame-pointers, the
  198.      function entry code must vary accordingly; it must set up the frame
  199.      pointer if one is wanted, and not otherwise.  To determine whether
  200.      a frame pointer is in wanted, the macro can refer to the variable
  201.      `frame_pointer_needed'.  The variable's value will be 1 at run
  202.      time in a function that needs a frame pointer.  *Note
  203.      Elimination::.
  204.      The function entry code is responsible for allocating any stack
  205.      space required for the function.  This stack space consists of the
  206.      regions listed below.  In most cases, these regions are allocated
  207.      in the order listed, with the last listed region closest to the
  208.      top of the stack (the lowest address if `STACK_GROWS_DOWNWARD' is
  209.      defined, and the highest address if it is not defined).  You can
  210.      use a different order for a machine if doing so is more convenient
  211.      or required for compatibility reasons.  Except in cases where
  212.      required by standard or by a debugger, there is no reason why the
  213.      stack layout used by GCC need agree with that used by other
  214.      compilers for a machine.
  215.         * A region of `current_function_pretend_args_size' bytes of
  216.           uninitialized space just underneath the first argument
  217.           arriving on the stack.  (This may not be at the very start of
  218.           the allocated stack region if the calling sequence has pushed
  219.           anything else since pushing the stack arguments.  But
  220.           usually, on such machines, nothing else has been pushed yet,
  221.           because the function prologue itself does all the pushing.)
  222.           This region is used on machines where an argument may be
  223.           passed partly in registers and partly in memory, and, in some
  224.           cases to support the features in `varargs.h' and `stdargs.h'.
  225.         * An area of memory used to save certain registers used by the
  226.           function.  The size of this area, which may also include
  227.           space for such things as the return address and pointers to
  228.           previous stack frames, is machine-specific and usually
  229.           depends on which registers have been used in the function.
  230.           Machines with register windows often do not require a save
  231.           area.
  232.         * A region of at least SIZE bytes, possibly rounded up to an
  233.           allocation boundary, to contain the local variables of the
  234.           function.  On some machines, this region and the save area
  235.           may occur in the opposite order, with the save area closer to
  236.           the top of the stack.
  237.         * Optionally, when `ACCUMULATE_OUTGOING_ARGS' is defined, a
  238.           region of `current_function_outgoing_args_size' bytes to be
  239.           used for outgoing argument lists of the function.  *Note
  240.           Stack Arguments::.
  241.      Normally, it is necessary for the macros `FUNCTION_PROLOGUE' and
  242.      `FUNCTION_EPILOGUE' to treat leaf functions specially.  The C
  243.      variable `leaf_function' is nonzero for such a function.
  244. `EXIT_IGNORE_STACK'
  245.      Define this macro as a C expression that is nonzero if the return
  246.      instruction or the function epilogue ignores the value of the stack
  247.      pointer; in other words, if it is safe to delete an instruction to
  248.      adjust the stack pointer before a return from the function.
  249.      Note that this macro's value is relevant only for functions for
  250.      which frame pointers are maintained.  It is never safe to delete a
  251.      final stack adjustment in a function that has no frame pointer,
  252.      and the compiler knows this regardless of `EXIT_IGNORE_STACK'.
  253. `FUNCTION_EPILOGUE (FILE, SIZE)'
  254.      A C compound statement that outputs the assembler code for exit
  255.      from a function.  The epilogue is responsible for restoring the
  256.      saved registers and stack pointer to their values when the
  257.      function was called, and returning control to the caller.  This
  258.      macro takes the same arguments as the macro `FUNCTION_PROLOGUE',
  259.      and the registers to restore are determined from `regs_ever_live'
  260.      and `CALL_USED_REGISTERS' in the same way.
  261.      On some machines, there is a single instruction that does all the
  262.      work of returning from the function.  On these machines, give that
  263.      instruction the name `return' and do not define the macro
  264.      `FUNCTION_EPILOGUE' at all.
  265.      Do not define a pattern named `return' if you want the
  266.      `FUNCTION_EPILOGUE' to be used.  If you want the target switches
  267.      to control whether return instructions or epilogues are used,
  268.      define a `return' pattern with a validity condition that tests the
  269.      target switches appropriately.  If the `return' pattern's validity
  270.      condition is false, epilogues will be used.
  271.      On machines where functions may or may not have frame-pointers, the
  272.      function exit code must vary accordingly.  Sometimes the code for
  273.      these two cases is completely different.  To determine whether a
  274.      frame pointer is wanted, the macro can refer to the variable
  275.      `frame_pointer_needed'.  The variable's value will be 1 when
  276.      compiling a function that needs a frame pointer.
  277.      Normally, `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE' must treat
  278.      leaf functions specially.  The C variable `leaf_function' is
  279.      nonzero for such a function.  *Note Leaf Functions::.
  280.      On some machines, some functions pop their arguments on exit while
  281.      others leave that for the caller to do.  For example, the 68020
  282.      when given `-mrtd' pops arguments in functions that take a fixed
  283.      number of arguments.
  284.      Your definition of the macro `RETURN_POPS_ARGS' decides which
  285.      functions pop their own arguments.  `FUNCTION_EPILOGUE' needs to
  286.      know what was decided.  The variable that is called
  287.      `current_function_pops_args' is the number of bytes of its
  288.      arguments that a function should pop.  *Note Scalar Return::.
  289. `DELAY_SLOTS_FOR_EPILOGUE'
  290.      Define this macro if the function epilogue contains delay slots to
  291.      which instructions from the rest of the function can be "moved".
  292.      The definition should be a C expression whose value is an integer
  293.      representing the number of delay slots there.
  294. `ELIGIBLE_FOR_EPILOGUE_DELAY (INSN, N)'
  295.      A C expression that returns 1 if INSN can be placed in delay slot
  296.      number N of the epilogue.
  297.      The argument N is an integer which identifies the delay slot now
  298.      being considered (since different slots may have different rules of
  299.      eligibility).  It is never negative and is always less than the
  300.      number of epilogue delay slots (what `DELAY_SLOTS_FOR_EPILOGUE'
  301.      returns).  If you reject a particular insn for a given delay slot,
  302.      in principle, it may be reconsidered for a subsequent delay slot.
  303.      Also, other insns may (at least in principle) be considered for
  304.      the so far unfilled delay slot.
  305.      The insns accepted to fill the epilogue delay slots are put in an
  306.      RTL list made with `insn_list' objects, stored in the variable
  307.      `current_function_epilogue_delay_list'.  The insn for the first
  308.      delay slot comes first in the list.  Your definition of the macro
  309.      `FUNCTION_EPILOGUE' should fill the delay slots by outputting the
  310.      insns in this list, usually by calling `final_scan_insn'.
  311.      You need not define this macro if you did not define
  312.      `DELAY_SLOTS_FOR_EPILOGUE'.
  313. File: gcc.info,  Node: Profiling,  Prev: Function Entry,  Up: Stack and Calling
  314. Generating Code for Profiling
  315. -----------------------------
  316.    These macros will help you generate code for profiling.
  317. `FUNCTION_PROFILER (FILE, LABELNO)'
  318.      A C statement or compound statement to output to FILE some
  319.      assembler code to call the profiling subroutine `mcount'.  Before
  320.      calling, the assembler code must load the address of a counter
  321.      variable into a register where `mcount' expects to find the
  322.      address.  The name of this variable is `LP' followed by the number
  323.      LABELNO, so you would generate the name using `LP%d' in a
  324.      `fprintf'.
  325.      The details of how the address should be passed to `mcount' are
  326.      determined by your operating system environment, not by GNU CC.  To
  327.      figure them out, compile a small program for profiling using the
  328.      system's installed C compiler and look at the assembler code that
  329.      results.
  330. `PROFILE_BEFORE_PROLOGUE'
  331.      Define this macro if the code for function profiling should come
  332.      before the function prologue.  Normally, the profiling code comes
  333.      after.
  334. `FUNCTION_BLOCK_PROFILER (FILE, LABELNO)'
  335.      A C statement or compound statement to output to FILE some
  336.      assembler code to initialize basic-block profiling for the current
  337.      object module.  This code should call the subroutine
  338.      `__bb_init_func' once per object module, passing it as its sole
  339.      argument the address of a block allocated in the object module.
  340.      The name of the block is a local symbol made with this statement:
  341.           ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
  342.      Of course, since you are writing the definition of
  343.      `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
  344.      can take a short cut in the definition of this macro and use the
  345.      name that you know will result.
  346.      The first word of this block is a flag which will be nonzero if the
  347.      object module has already been initialized.  So test this word
  348.      first, and do not call `__bb_init_func' if the flag is nonzero.
  349. `BLOCK_PROFILER (FILE, BLOCKNO)'
  350.      A C statement or compound statement to increment the count
  351.      associated with the basic block number BLOCKNO.  Basic blocks are
  352.      numbered separately from zero within each compilation.  The count
  353.      associated with block number BLOCKNO is at index BLOCKNO in a
  354.      vector of words; the name of this array is a local symbol made
  355.      with this statement:
  356.           ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
  357.      Of course, since you are writing the definition of
  358.      `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
  359.      can take a short cut in the definition of this macro and use the
  360.      name that you know will result.
  361. `BLOCK_PROFILER_CODE'
  362.      A C function or functions which are needed in the library to
  363.      support block profiling.
  364. File: gcc.info,  Node: Varargs,  Next: Trampolines,  Prev: Stack and Calling,  Up: Target Macros
  365. Implementing the Varargs Macros
  366. ===============================
  367.    GNU CC comes with an implementation of `varargs.h' and `stdarg.h'
  368. that work without change on machines that pass arguments on the stack.
  369. Other machines require their own implementations of varargs, and the
  370. two machine independent header files must have conditionals to include
  371.    ANSI `stdarg.h' differs from traditional `varargs.h' mainly in the
  372. calling convention for `va_start'.  The traditional implementation
  373. takes just one argument, which is the variable in which to store the
  374. argument pointer.  The ANSI implementation of `va_start' takes an
  375. additional second argument.  The user is supposed to write the last
  376. named argument of the function here.
  377.    However, `va_start' should not use this argument.  The way to find
  378. the end of the named arguments is with the built-in functions described
  379. below.
  380. `__builtin_saveregs ()'
  381.      Use this built-in function to save the argument registers in
  382.      memory so that the varargs mechanism can access them.  Both ANSI
  383.      and traditional versions of `va_start' must use
  384.      `__builtin_saveregs', unless you use `SETUP_INCOMING_VARARGS' (see
  385.      below) instead.
  386.      On some machines, `__builtin_saveregs' is open-coded under the
  387.      control of the macro `EXPAND_BUILTIN_SAVEREGS'.  On other machines,
  388.      it calls a routine written in assembler language, found in
  389.      `libgcc2.c'.
  390.      Code generated for the call to `__builtin_saveregs' appears at the
  391.      beginning of the function, as opposed to where the call to
  392.      `__builtin_saveregs' is written, regardless of what the code is.
  393.      This is because the registers must be saved before the function
  394.      starts to use them for its own purposes.
  395. `__builtin_args_info (CATEGORY)'
  396.      Use this built-in function to find the first anonymous arguments in
  397.      registers.
  398.      In general, a machine may have several categories of registers
  399.      used for arguments, each for a particular category of data types.
  400.      (For example, on some machines, floating-point registers are used
  401.      for floating-point arguments while other arguments are passed in
  402.      the general registers.) To make non-varargs functions use the
  403.      proper calling convention, you have defined the `CUMULATIVE_ARGS'
  404.      data type to record how many registers in each category have been
  405.      used so far
  406.      `__builtin_args_info' accesses the same data structure of type
  407.      `CUMULATIVE_ARGS' after the ordinary argument layout is finished
  408.      with it, with CATEGORY specifying which word to access.  Thus, the
  409.      value indicates the first unused register in a given category.
  410.      Normally, you would use `__builtin_args_info' in the implementation
  411.      of `va_start', accessing each category just once and storing the
  412.      value in the `va_list' object.  This is because `va_list' will
  413.      have to update the values, and there is no way to alter the values
  414.      accessed by `__builtin_args_info'.
  415. `__builtin_next_arg (LASTARG)'
  416.      This is the equivalent of `__builtin_args_info', for stack
  417.      arguments.  It returns the address of the first anonymous stack
  418.      argument, as type `void *'. If `ARGS_GROW_DOWNWARD', it returns
  419.      the address of the location above the first anonymous stack
  420.      argument.  Use it in `va_start' to initialize the pointer for
  421.      fetching arguments from the stack.  Also use it in `va_start' to
  422.      verify that the second parameter LASTARG is the last named argument
  423.      of the current function.
  424. `__builtin_classify_type (OBJECT)'
  425.      Since each machine has its own conventions for which data types are
  426.      passed in which kind of register, your implementation of `va_arg'
  427.      has to embody these conventions.  The easiest way to categorize the
  428.      specified data type is to use `__builtin_classify_type' together
  429.      with `sizeof' and `__alignof__'.
  430.      `__builtin_classify_type' ignores the value of OBJECT, considering
  431.      only its data type.  It returns an integer describing what kind of
  432.      type that is--integer, floating, pointer, structure, and so on.
  433.      The file `typeclass.h' defines an enumeration that you can use to
  434.      interpret the values of `__builtin_classify_type'.
  435.    These machine description macros help implement varargs:
  436. `EXPAND_BUILTIN_SAVEREGS (ARGS)'
  437.      If defined, is a C expression that produces the machine-specific
  438.      code for a call to `__builtin_saveregs'.  This code will be moved
  439.      to the very beginning of the function, before any parameter access
  440.      are made.  The return value of this function should be an RTX that
  441.      contains the value to use as the return of `__builtin_saveregs'.
  442.      The argument ARGS is a `tree_list' containing the arguments that
  443.      were passed to `__builtin_saveregs'.
  444.      If this macro is not defined, the compiler will output an ordinary
  445.      call to the library function `__builtin_saveregs'.
  446. `SETUP_INCOMING_VARARGS (ARGS_SO_FAR, MODE, TYPE,'
  447.      PRETEND_ARGS_SIZE, SECOND_TIME) This macro offers an alternative
  448.      to using `__builtin_saveregs' and defining the macro
  449.      `EXPAND_BUILTIN_SAVEREGS'.  Use it to store the anonymous register
  450.      arguments into the stack so that all the arguments appear to have
  451.      been passed consecutively on the stack.  Once this is done, you
  452.      can use the standard implementation of varargs that works for
  453.      machines that pass all their arguments on the stack.
  454.      The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure,
  455.      containing the values that obtain after processing of the named
  456.      arguments.  The arguments MODE and TYPE describe the last named
  457.      argument--its machine mode and its data type as a tree node.
  458.      The macro implementation should do two things: first, push onto the
  459.      stack all the argument registers *not* used for the named
  460.      arguments, and second, store the size of the data thus pushed into
  461.      the `int'-valued variable whose name is supplied as the argument
  462.      PRETEND_ARGS_SIZE.  The value that you store here will serve as
  463.      additional offset for setting up the stack frame.
  464.      Because you must generate code to push the anonymous arguments at
  465.      compile time without knowing their data types,
  466.      `SETUP_INCOMING_VARARGS' is only useful on machines that have just
  467.      a single category of argument register and use it uniformly for
  468.      all data types.
  469.      If the argument SECOND_TIME is nonzero, it means that the
  470.      arguments of the function are being analyzed for the second time.
  471.      This happens for an inline function, which is not actually
  472.      compiled until the end of the source file.  The macro
  473.      `SETUP_INCOMING_VARARGS' should not generate any instructions in
  474.      this case.
  475. File: gcc.info,  Node: Trampolines,  Next: Library Calls,  Prev: Varargs,  Up: Target Macros
  476. Trampolines for Nested Functions
  477. ================================
  478.    A "trampoline" is a small piece of code that is created at run time
  479. when the address of a nested function is taken.  It normally resides on
  480. the stack, in the stack frame of the containing function.  These macros
  481. tell GNU CC how to generate code to allocate and initialize a
  482. trampoline.
  483.    The instructions in the trampoline must do two things: load a
  484. constant address into the static chain register, and jump to the real
  485. address of the nested function.  On CISC machines such as the m68k,
  486. this requires two instructions, a move immediate and a jump.  Then the
  487. two addresses exist in the trampoline as word-long immediate operands.
  488. On RISC machines, it is often necessary to load each address into a
  489. register in two parts.  Then pieces of each address form separate
  490. immediate operands.
  491.    The code generated to initialize the trampoline must store the
  492. variable parts--the static chain value and the function address--into
  493. the immediate operands of the instructions.  On a CISC machine, this is
  494. simply a matter of copying each address to a memory reference at the
  495. proper offset from the start of the trampoline.  On a RISC machine, it
  496. may be necessary to take out pieces of the address and store them
  497. separately.
  498. `TRAMPOLINE_TEMPLATE (FILE)'
  499.      A C statement to output, on the stream FILE, assembler code for a
  500.      block of data that contains the constant parts of a trampoline.
  501.      This code should not include a label--the label is taken care of
  502.      automatically.
  503. `TRAMPOLINE_SECTION'
  504.      The name of a subroutine to switch to the section in which the
  505.      trampoline template is to be placed (*note Sections::.).  The
  506.      default is a value of `readonly_data_section', which places the
  507.      trampoline in the section containing read-only data.
  508. `TRAMPOLINE_SIZE'
  509.      A C expression for the size in bytes of the trampoline, as an
  510.      integer.
  511. `TRAMPOLINE_ALIGNMENT'
  512.      Alignment required for trampolines, in bits.
  513.      If you don't define this macro, the value of `BIGGEST_ALIGNMENT'
  514.      is used for aligning trampolines.
  515. `INITIALIZE_TRAMPOLINE (ADDR, FNADDR, STATIC_CHAIN)'
  516.      A C statement to initialize the variable parts of a trampoline.
  517.      aDDR is an RTX for the address of the trampoline; FNADDR is an RTX
  518.      for the address of the nested function; STATIC_CHAIN is an RTX for
  519.      the static chain value that should be passed to the function when
  520.      it is called.
  521. `ALLOCATE_TRAMPOLINE (FP)'
  522.      A C expression to allocate run-time space for a trampoline.  The
  523.      expression value should be an RTX representing a memory reference
  524.      to the space for the trampoline.
  525.      If this macro is not defined, by default the trampoline is
  526.      allocated as a stack slot.  This default is right for most
  527.      machines.  The exceptions are machines where it is impossible to
  528.      execute instructions in the stack area.  On such machines, you may
  529.      have to implement a separate stack, using this macro in
  530.      conjunction with `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE'.
  531.      FP points to a data structure, a `struct function', which
  532.      describes the compilation status of the immediate containing
  533.      function of the function which the trampoline is for.  Normally
  534.      (when `ALLOCATE_TRAMPOLINE' is not defined), the stack slot for the
  535.      trampoline is in the stack frame of this containing function.
  536.      Other allocation strategies probably must do something analogous
  537.      with this information.
  538.    Implementing trampolines is difficult on many machines because they
  539. have separate instruction and data caches.  Writing into a stack
  540. location fails to clear the memory in the instruction cache, so when
  541. the program jumps to that location, it executes the old contents.
  542.    Here are two possible solutions.  One is to clear the relevant parts
  543. of the instruction cache whenever a trampoline is set up.  The other is
  544. to make all trampolines identical, by having them jump to a standard
  545. subroutine.  The former technique makes trampoline execution faster; the
  546. latter makes initialization faster.
  547.    To clear the instruction cache when a trampoline is initialized,
  548. define the following macros which describe the shape of the cache.
  549. `INSN_CACHE_SIZE'
  550.      The total size in bytes of the cache.
  551. `INSN_CACHE_LINE_WIDTH'
  552.      The length in bytes of each cache line.  The cache is divided into
  553.      cache lines which are disjoint slots, each holding a contiguous
  554.      chunk of data fetched from memory.  Each time data is brought into
  555.      the cache, an entire line is read at once.  The data loaded into a
  556.      cache line is always aligned on a boundary equal to the line size.
  557. `INSN_CACHE_DEPTH'
  558.      The number of alternative cache lines that can hold any particular
  559.      memory location.
  560.    Alternatively, if the machine has system calls or instructions to
  561. clear the instruction cache directly, you can define the following
  562. macro.
  563. `CLEAR_INSN_CACHE (BEG, END)'
  564.      If defined, expands to a C expression clearing the *instruction
  565.      cache* in the specified interval.  If it is not defined, and the
  566.      macro INSN_CACHE_SIZE is defined, some generic code is generated
  567.      to clear the cache.  The definition of this macro would typically
  568.      be a series of `asm' statements.  Both BEG and END are both pointer
  569.      expressions.
  570.    To use a standard subroutine, define the following macro.  In
  571. addition, you must make sure that the instructions in a trampoline fill
  572. an entire cache line with identical instructions, or else ensure that
  573. the beginning of the trampoline code is always aligned at the same
  574. point in its cache line.  Look in `m68k.h' as a guide.
  575. `TRANSFER_FROM_TRAMPOLINE'
  576.      Define this macro if trampolines need a special subroutine to do
  577.      their work.  The macro should expand to a series of `asm'
  578.      statements which will be compiled with GNU CC.  They go in a
  579.      library function named `__transfer_from_trampoline'.
  580.      If you need to avoid executing the ordinary prologue code of a
  581.      compiled C function when you jump to the subroutine, you can do so
  582.      by placing a special label of your own in the assembler code.  Use
  583.      one `asm' statement to generate an assembler label, and another to
  584.      make the label global.  Then trampolines can use that label to
  585.      jump directly to your special assembler code.
  586. File: gcc.info,  Node: Library Calls,  Next: Addressing Modes,  Prev: Trampolines,  Up: Target Macros
  587. Implicit Calls to Library Routines
  588. ==================================
  589. `MULSI3_LIBCALL'
  590.      A C string constant giving the name of the function to call for
  591.      multiplication of one signed full-word by another.  If you do not
  592.      define this macro, the default name is used, which is `__mulsi3',
  593.      a function defined in `libgcc.a'.
  594. `DIVSI3_LIBCALL'
  595.      A C string constant giving the name of the function to call for
  596.      division of one signed full-word by another.  If you do not define
  597.      this macro, the default name is used, which is `__divsi3', a
  598.      function defined in `libgcc.a'.
  599. `UDIVSI3_LIBCALL'
  600.      A C string constant giving the name of the function to call for
  601.      division of one unsigned full-word by another.  If you do not
  602.      define this macro, the default name is used, which is `__udivsi3',
  603.      a function defined in `libgcc.a'.
  604. `MODSI3_LIBCALL'
  605.      A C string constant giving the name of the function to call for the
  606.      remainder in division of one signed full-word by another.  If you
  607.      do not define this macro, the default name is used, which is
  608.      `__modsi3', a function defined in `libgcc.a'.
  609. `UMODSI3_LIBCALL'
  610.      A C string constant giving the name of the function to call for the
  611.      remainder in division of one unsigned full-word by another.  If
  612.      you do not define this macro, the default name is used, which is
  613.      `__umodsi3', a function defined in `libgcc.a'.
  614. `MULDI3_LIBCALL'
  615.      A C string constant giving the name of the function to call for
  616.      multiplication of one signed double-word by another.  If you do not
  617.      define this macro, the default name is used, which is `__muldi3',
  618.      a function defined in `libgcc.a'.
  619. `DIVDI3_LIBCALL'
  620.      A C string constant giving the name of the function to call for
  621.      division of one signed double-word by another.  If you do not
  622.      define this macro, the default name is used, which is `__divdi3', a
  623.      function defined in `libgcc.a'.
  624. `UDIVDI3_LIBCALL'
  625.      A C string constant giving the name of the function to call for
  626.      division of one unsigned full-word by another.  If you do not
  627.      define this macro, the default name is used, which is `__udivdi3',
  628.      a function defined in `libgcc.a'.
  629. `MODDI3_LIBCALL'
  630.      A C string constant giving the name of the function to call for the
  631.      remainder in division of one signed double-word by another.  If
  632.      you do not define this macro, the default name is used, which is
  633.      `__moddi3', a function defined in `libgcc.a'.
  634. `UMODDI3_LIBCALL'
  635.      A C string constant giving the name of the function to call for the
  636.      remainder in division of one unsigned full-word by another.  If
  637.      you do not define this macro, the default name is used, which is
  638.      `__umoddi3', a function defined in `libgcc.a'.
  639. `INIT_TARGET_OPTABS'
  640.      Define this macro as a C statement that declares additional library
  641.      routines renames existing ones. `init_optabs' calls this macro
  642.      after initializing all the normal library routines.
  643. `TARGET_EDOM'
  644.      The value of `EDOM' on the target machine, as a C integer constant
  645.      expression.  If you don't define this macro, GNU CC does not
  646.      attempt to deposit the value of `EDOM' into `errno' directly.
  647.      Look in `/usr/include/errno.h' to find the value of `EDOM' on your
  648.      system.
  649.      If you do not define `TARGET_EDOM', then compiled code reports
  650.      domain errors by calling the library function and letting it
  651.      report the error.  If mathematical functions on your system use
  652.      `matherr' when there is an error, then you should leave
  653.      `TARGET_EDOM' undefined so that `matherr' is used normally.
  654. `GEN_ERRNO_RTX'
  655.      Define this macro as a C expression to create an rtl expression
  656.      that refers to the global "variable" `errno'.  (On certain systems,
  657.      `errno' may not actually be a variable.)  If you don't define this
  658.      macro, a reasonable default is used.
  659. `TARGET_MEM_FUNCTIONS'
  660.      Define this macro if GNU CC should generate calls to the System V
  661.      (and ANSI C) library functions `memcpy' and `memset' rather than
  662.      the BSD functions `bcopy' and `bzero'.
  663. `LIBGCC_NEEDS_DOUBLE'
  664.      Define this macro if only `float' arguments cannot be passed to
  665.      library routines (so they must be converted to `double').  This
  666.      macro affects both how library calls are generated and how the
  667.      library routines in `libgcc1.c' accept their arguments.  It is
  668.      useful on machines where floating and fixed point arguments are
  669.      passed differently, such as the i860.
  670. `FLOAT_ARG_TYPE'
  671.      Define this macro to override the type used by the library
  672.      routines to pick up arguments of type `float'.  (By default, they
  673.      use a union of `float' and `int'.)
  674.      The obvious choice would be `float'--but that won't work with
  675.      traditional C compilers that expect all arguments declared as
  676.      `float' to arrive as `double'.  To avoid this conversion, the
  677.      library routines ask for the value as some other type and then
  678.      treat it as a `float'.
  679.      On some systems, no other type will work for this.  For these
  680.      systems, you must use `LIBGCC_NEEDS_DOUBLE' instead, to force
  681.      conversion of the values `double' before they are passed.
  682. `FLOATIFY (PASSED-VALUE)'
  683.      Define this macro to override the way library routines redesignate
  684.      a `float' argument as a `float' instead of the type it was passed
  685.      as.  The default is an expression which takes the `float' field of
  686.      the union.
  687. `FLOAT_VALUE_TYPE'
  688.      Define this macro to override the type used by the library
  689.      routines to return values that ought to have type `float'.  (By
  690.      default, they use `int'.)
  691.      The obvious choice would be `float'--but that won't work with
  692.      traditional C compilers gratuitously convert values declared as
  693.      `float' into `double'.
  694. `INTIFY (FLOAT-VALUE)'
  695.      Define this macro to override the way the value of a
  696.      `float'-returning library routine should be packaged in order to
  697.      return it.  These functions are actually declared to return type
  698.      `FLOAT_VALUE_TYPE' (normally `int').
  699.      These values can't be returned as type `float' because traditional
  700.      C compilers would gratuitously convert the value to a `double'.
  701.      A local variable named `intify' is always available when the macro
  702.      `INTIFY' is used.  It is a union of a `float' field named `f' and
  703.      a field named `i' whose type is `FLOAT_VALUE_TYPE' or `int'.
  704.      If you don't define this macro, the default definition works by
  705.      copying the value through that union.
  706. `nongcc_SI_type'
  707.      Define this macro as the name of the data type corresponding to
  708.      `SImode' in the system's own C compiler.
  709.      You need not define this macro if that type is `long int', as it
  710.      usually is.
  711. `nongcc_word_type'
  712.      Define this macro as the name of the data type corresponding to the
  713.      word_mode in the system's own C compiler.
  714.      You need not define this macro if that type is `long int', as it
  715.      usually is.
  716. `perform_...'
  717.      Define these macros to supply explicit C statements to carry out
  718.      various arithmetic operations on types `float' and `double' in the
  719.      library routines in `libgcc1.c'.  See that file for a full list of
  720.      these macros and their arguments.
  721.      On most machines, you don't need to define any of these macros,
  722.      because the C compiler that comes with the system takes care of
  723.      doing them.
  724. `NEXT_OBJC_RUNTIME'
  725.      Define this macro to generate code for Objective C message sending
  726.      using the calling convention of the NeXT system.  This calling
  727.      convention involves passing the object, the selector and the
  728.      method arguments all at once to the method-lookup library function.
  729.      The default calling convention passes just the object and the
  730.      selector to the lookup function, which returns a pointer to the
  731.      method.
  732. File: gcc.info,  Node: Addressing Modes,  Next: Condition Code,  Prev: Library Calls,  Up: Target Macros
  733. Addressing Modes
  734. ================
  735. `HAVE_POST_INCREMENT'
  736.      Define this macro if the machine supports post-increment
  737.      addressing.
  738. `HAVE_PRE_INCREMENT'
  739. `HAVE_POST_DECREMENT'
  740. `HAVE_PRE_DECREMENT'
  741.      Similar for other kinds of addressing.
  742. `CONSTANT_ADDRESS_P (X)'
  743.      A C expression that is 1 if the RTX X is a constant which is a
  744.      valid address.  On most machines, this can be defined as
  745.      `CONSTANT_P (X)', but a few machines are more restrictive in which
  746.      constant addresses are supported.
  747.      `CONSTANT_P' accepts integer-values expressions whose values are
  748.      not explicitly known, such as `symbol_ref', `label_ref', and
  749.      `high' expressions and `const' arithmetic expressions, in addition
  750.      to `const_int' and `const_double' expressions.
  751. `MAX_REGS_PER_ADDRESS'
  752.      A number, the maximum number of registers that can appear in a
  753.      valid memory address.  Note that it is up to you to specify a
  754.      value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS'
  755.      would ever accept.
  756. `GO_IF_LEGITIMATE_ADDRESS (MODE, X, LABEL)'
  757.      A C compound statement with a conditional `goto LABEL;' executed
  758.      if X (an RTX) is a legitimate memory address on the target machine
  759.      for a memory operand of mode MODE.
  760.      It usually pays to define several simpler macros to serve as
  761.      subroutines for this one.  Otherwise it may be too complicated to
  762.      understand.
  763.      This macro must exist in two variants: a strict variant and a
  764.      non-strict one.  The strict variant is used in the reload pass.  It
  765.      must be defined so that any pseudo-register that has not been
  766.      allocated a hard register is considered a memory reference.  In
  767.      contexts where some kind of register is required, a pseudo-register
  768.      with no hard register must be rejected.
  769.      The non-strict variant is used in other passes.  It must be
  770.      defined to accept all pseudo-registers in every context where some
  771.      kind of register is required.
  772.      Compiler source files that want to use the strict variant of this
  773.      macro define the macro `REG_OK_STRICT'.  You should use an `#ifdef
  774.      REG_OK_STRICT' conditional to define the strict variant in that
  775.      case and the non-strict variant otherwise.
  776.      Subroutines to check for acceptable registers for various purposes
  777.      (one for base registers, one for index registers, and so on) are
  778.      typically among the subroutines used to define
  779.      `GO_IF_LEGITIMATE_ADDRESS'.  Then only these subroutine macros
  780.      need have two variants; the higher levels of macros may be the
  781.      same whether strict or not.
  782.      Normally, constant addresses which are the sum of a `symbol_ref'
  783.      and an integer are stored inside a `const' RTX to mark them as
  784.      constant.  Therefore, there is no need to recognize such sums
  785.      specifically as legitimate addresses.  Normally you would simply
  786.      recognize any `const' as legitimate.
  787.      Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant
  788.      sums that are not marked with  `const'.  It assumes that a naked
  789.      `plus' indicates indexing.  If so, then you *must* reject such
  790.      naked constant sums as illegitimate addresses, so that none of
  791.      them will be given to `PRINT_OPERAND_ADDRESS'.
  792.      On some machines, whether a symbolic address is legitimate depends
  793.      on the section that the address refers to.  On these machines,
  794.      define the macro `ENCODE_SECTION_INFO' to store the information
  795.      into the `symbol_ref', and then check for it here.  When you see a
  796.      `const', you will have to look inside it to find the `symbol_ref'
  797.      in order to determine the section.  *Note Assembler Format::.
  798.      The best way to modify the name string is by adding text to the
  799.      beginning, with suitable punctuation to prevent any ambiguity.
  800.      Allocate the new name in `saveable_obstack'.  You will have to
  801.      modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
  802.      and output the name accordingly, and define `STRIP_NAME_ENCODING'
  803.      to access the original name string.
  804.      You can check the information stored here into the `symbol_ref' in
  805.      the definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and
  806.      `PRINT_OPERAND_ADDRESS'.
  807. `REG_OK_FOR_BASE_P (X)'
  808.      A C expression that is nonzero if X (assumed to be a `reg' RTX) is
  809.      valid for use as a base register.  For hard registers, it should
  810.      always accept those which the hardware permits and reject the
  811.      others.  Whether the macro accepts or rejects pseudo registers
  812.      must be controlled by `REG_OK_STRICT' as described above.  This
  813.      usually requires two variant definitions, of which `REG_OK_STRICT'
  814.      controls the one actually used.
  815. `REG_OK_FOR_INDEX_P (X)'
  816.      A C expression that is nonzero if X (assumed to be a `reg' RTX) is
  817.      valid for use as an index register.
  818.      The difference between an index register and a base register is
  819.      that the index register may be scaled.  If an address involves the
  820.      sum of two registers, neither one of them scaled, then either one
  821.      may be labeled the "base" and the other the "index"; but whichever
  822.      labeling is used must fit the machine's constraints of which
  823.      registers may serve in each capacity.  The compiler will try both
  824.      labelings, looking for one that is valid, and will reload one or
  825.      both registers only if neither labeling works.
  826. `LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN)'
  827.      A C compound statement that attempts to replace X with a valid
  828.      memory address for an operand of mode MODE.  WIN will be a C
  829.      statement label elsewhere in the code; the macro definition may use
  830.           GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
  831.      to avoid further processing if the address has become legitimate.
  832.      X will always be the result of a call to `break_out_memory_refs',
  833.      and OLDX will be the operand that was given to that function to
  834.      produce X.
  835.      The code generated by this macro should not alter the substructure
  836.      of X.  If it transforms X into a more legitimate form, it should
  837.      assign X (which will always be a C variable) a new value.
  838.      It is not necessary for this macro to come up with a legitimate
  839.      address.  The compiler has standard ways of doing so in all cases.
  840.      In fact, it is safe for this macro to do nothing.  But often a
  841.      machine-dependent strategy can generate better code.
  842. `GO_IF_MODE_DEPENDENT_ADDRESS (ADDR, LABEL)'
  843.      A C statement or compound statement with a conditional `goto
  844.      LABEL;' executed if memory address X (an RTX) can have different
  845.      meanings depending on the machine mode of the memory reference it
  846.      is used for or if the address is valid for some modes but not
  847.      others.
  848.      Autoincrement and autodecrement addresses typically have
  849.      mode-dependent effects because the amount of the increment or
  850.      decrement is the size of the operand being addressed.  Some
  851.      machines have other mode-dependent addresses.  Many RISC machines
  852.      have no mode-dependent addresses.
  853.      You may assume that ADDR is a valid address for the machine.
  854. `LEGITIMATE_CONSTANT_P (X)'
  855.      A C expression that is nonzero if X is a legitimate constant for
  856.      an immediate operand on the target machine.  You can assume that X
  857.      satisfies `CONSTANT_P', so you need not check this.  In fact, `1'
  858.      is a suitable definition for this macro on machines where anything
  859.      `CONSTANT_P' is valid.
  860.